<?php
$name = system_controller_front::getInstance()->getRequest()->getActionName();
$search = 'list';
if($name == 'recommend') $search = $name;
?>
<div class="body tabs">
	<form action="<?php echo $this->url('picture/special/' . $search);?>" method="get">
	<?php echo $this->form()->hidden('order', $this->order);?>
	<?php echo $this->form()->hidden('sort', $this->sort);?>
	<ul class="list">
		<li<?php if($name=='list') echo ' class="current"'; ?>><a href="<?php echo $this->url('picture/special/list');?>"><?php echo $this->language('LIST ALL');?><?php if($name=='list') echo ' »'; ?></a></li>
		<?php if(!($this->row && $this->row->getId())) { ?>
		<li<?php if($name=='recommend') echo ' class="current"'; ?>><a href="<?php echo $this->url('picture/special/recommend');?>"><?php echo $this->language('RECOMMEND');?><?php if($name=='recommend') echo ' »'; ?></a></li>
		<li<?php if($name=='regroup') echo ' class="current"'; ?>><a href="<?php echo $this->url('picture/special/regroup');?>"><?php echo $this->language('Re-GROUP');?><?php if($name=='regroup') echo ' »'; ?></a></li>
		<li><a href="<?php echo $this->url('picture/import/special');?>"><?php echo $this->language('IMPORT');?></a></li>
		<?php } ?>
		<?php if($this->row && $this->row->getId()) { ?>
		<li<?php if($name=='edit') echo ' class="current"'; ?>>
			<a href="<?php echo $this->url('picture/special/edit', array('id' => $this->row->getId()));?>"><?php echo $this->language('EDIT SPECIAL');?><?php if($name=='edit') echo ' »'; ?></a>
		</li>
		<li<?php if($name=='photo' || $name=='addPhoto') echo ' class="current"'; ?>>
			<a href="<?php echo $this->url('picture/special/photo', array('id' => $this->row->getId()));?>"><?php echo $this->language('PHOTO LIST');?><?php if($name=='photo' || $name=='addPhoto') echo ' »'; ?></a>
		</li>
		<?php if($name=='delete') { ?>
		<li class="current">
			<a href="<?php echo $this->url('picture/special/delete', array('id' => $this->row->getId()));?>"><?php echo $this->language('DELETE');?> »</a>
		</li>
		<?php } ?>
		<?php } else { ?>
		<li<?php if($name=='addnew') echo ' class="current"'; ?>>
			<a href="<?php echo $this->url('picture/special/addnew', array(), array('category_id' => intval($this->category_id)));?>"><?php echo $this->language('CREATE SPECIAL');?><?php if($name=='addnew') echo ' »'; ?></a>
		</li>
		<?php } ?>
		<li class="rs">
			<span><?php echo $this->partial('picture/_inc/categorySelect.phtml', array('name' => 'category_id', 'selectedId' => intval($this->category_id)));?></span>
			<?php
			if($name == 'recommend') {
				echo '<span><select name="group_id"><option>=GROUP=</option>';
				foreach($this->regroups AS $group) {
					echo '<option value="' . $group->getId() . '"';
					if(intval($this->group_id) == $group->getId()) {
						echo ' selected="selected"';
					}
					echo '>' . $this->escape($group->getDescription()) . '[' . $group->getName() . ']</option>';
				}
				echo '</select></span>';
			}
			?>
			<span><?php echo $this->render('include/searchInput.phtml');?></span>
			<span><button type="submit" value="Search" class="small">Search</button></span>
		</li>
	</ul>
	<div class="clearfix"></div>
	</form>
</div>
